package com.reshare.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.reshare.base.BaseService;
import com.reshare.bean.SysLog;
import com.reshare.mapper.SysLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/*功能描述
 * @author ahm
 */
@Service
public class SysLogService extends BaseService<SysLog,Integer> {

    @Autowired(required = false)
    private SysLogMapper sysLogMapper;

    public Map<String,Object> findAll(int pageNum,int pageSize){

        List<SysLog> all = sysLogMapper.findAll();
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<SysLog> pageInfo = new PageInfo<>(all);


        HashMap<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "success");
        map.put("count", pageInfo.getTotal());
        map.put("data", pageInfo.getList());
        return map;


    }


}
